

function CalABRandQ()
    filename = 'BQ';
    tempInputPath=['E:\\Kuner\\BYLW\\Jworkspace\\saltyCode\\testify\\data\\',filename,'.csv'];
    outputPath = ['E:\\Kuner\\BYLW\\Jworkspace\\saltyCode\\testify\\data\\',filename,'_Rslt.csv'];
    delimiterIn = ',';
    headerlinesIn = 1;
 A = importdata(tempInputPath,delimiterIn,headerlinesIn);
        [n,m] = size(A.data);

xdata=A.data(1:n,1);

x0 = [0,0,0];
options = optimoptions(@lsqnonlin,'Algorithm','trust-region-reflective');
fid = fopen(outputPath, 'w');
for j=2:m
   ydata=A.data(1:n,j);
   fun = @(x) x(1)-x(2)*exp(-x(3)*xdata) - ydata;
   x = lsqnonlin(fun,x0,[],[],options);
  % fprintf(fid,'\n' );
   fprintf(fid,'%.10f,%.10f,%.10f\n',x );
   for k=1:n
       val = x(1)-x(2)*exp(-x(3)*xdata(k));
      %  fprintf(fid,'%.4f,%.10f,%.10f\n',xdata(k),ydata(k),val);
   end
end
fclose(fid);





